﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DDD_AOP_WCF.Domain;
using DDD_AOP_WCF.Domain.DTO;
using DDD_AOP_WCF.Domain.Products;
using Infrastructure.Core;
using Domain.Core.Repository;
namespace DDD_AOP_WCF.Infrastructure.Repository
{

    public class ProductRepository : DbContextRepository<Product>, IProductRepository
    {
        //public ProductRepository(IUnitOfWork db) //使用ＩＯＣ这行要注释，如果不注释，需要在配置文件中将dbContext传入
        //    : base(db)
        //{

        //}
        public ProductRepository()
            : base(new backgroundEntities())
        {

        }
        #region IProductRepository 成员

        public IQueryable<Product> GetProduct()
        {
            return this.GetModel();
        }

        public void AddProduct(Product entity)
        {
            this.Insert(entity);
        }

        public void ModifyProduct(System.Linq.Expressions.Expression<Action<Product>> entity)
        {
            this.Update(entity);
        }

        #endregion
    }
}